import asyncio
import time

from playwright.async_api import async_playwright, expect


async def main():
    async with async_playwright() as p:
        browser = await p.chromium.launch(headless=False)
        page = await browser.new_page()
        await page.goto("https://www.baidu.com")

        await expect(page).to_have_title('百度一下，你就知道')
        local = page.locator('#su')
        await expect(local).to_have_text('百度一下')
        await expect(local).to_have_attribute('type','text')

        await browser.close()

asyncio.run(main())
